package com.woniu.servicesse.util;

import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

public class SseConnection {
    private final SseEmitter emitter;
    private volatile boolean isCompleted;

    public SseConnection(SseEmitter emitter) {
        this.emitter = emitter;
        this.isCompleted = false;
    }

    public boolean isCompleted() {
        return isCompleted;
    }

    public void complete() {
        this.isCompleted = true;
        this.emitter.complete();
    }

    public SseEmitter getEmitter() {
        return emitter;
    }
}
